package com.lanou3g.ptp.filecontrol.service.Impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.lanou3g.ptp.filecontrol.service.DownloadService;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.OutputStream;

@Service
public class DownloadServiceImpl implements DownloadService {
    @Override
    public OutputStream filedownload(Long taskId, Long studentId,String fileName) {

        String parent = "/Users/mylovelyziwei/IdeaProjects/ptp/ptp-filecontrol-service/target";

        String newPath = parent + "/" + taskId + "/" + studentId + "/" + fileName;

        FileOutputStream outputStream = null;
        try {
            outputStream = new FileOutputStream(newPath);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }

        return outputStream;
    }
}
